/*
 * Copyright (c) 2025, 大连理工大学 (Dalian University of Technology)
 *
 * Licensed under the Mulan PSL v2.
 * You can use this file according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of the License at
 *
 *     http://license.coscl.org.cn/MulanPSL2
 *
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. SEE THE MULAN PSL v2
 * FOR MORE DETAILS.
 */

#pragma once
#include <complex>

#include "DataStructure/Input/Solver/AnaysisTypes.h"
#include "DataStructure/Result/Nodal/EIGENVECTOR_CPLXData.h"

#include "DBManager/Common/Trait/ResultTrait.h"
#include "DBManager/DBServiceFactory.h"

SG_DBMANAGER_NAMESPACE_OPEN

class DBManager_DECLSPEC IEIGENVECTOR_CPLXService : public Post::AddTrait<SG::DataStructure::Post::EIGENVECTOR_CPLXData>,
                                                    public Post::FindByDomainTrait<SG::DataStructure::Post::EIGENVECTOR_CPLXData>
{
  public:
    virtual ~IEIGENVECTOR_CPLXService () {};

    using Post::FindByDomainTrait<SG::DataStructure::Post::EIGENVECTOR_CPLXData>::Find;
    using Post::AddTrait<SG::DataStructure::Post::EIGENVECTOR_CPLXData>::Add;

    virtual SG::DataStructure::Common::Status Find (const SG::DataStructure::FEM::SOLType                           analysisType,
                                                    const SG::DataStructure::Common::Id                              subcaseId,
                                                    const SG::DataStructure::Common::I64                             mode,
                                                    std::vector<SG::DataStructure::Post::EIGENVECTOR_CPLXData>& _OUT entity) = 0;


    /**
     * @brief    save eigen vector result
     *
     * @param    analysisType analysis type
     * @param    subcaseId
     * @param    entity
     * @author   wxc
     * @date     2024.11.27
     */
    virtual SG::DataStructure::Common::Status Add (const SG::DataStructure::FEM::SOLType                      analysisType,
                                                   const SG::DataStructure::Common::Id                         subcaseId,
                                                   const SG::DataStructure::Common::I64                        mode,
                                                   const std::complex<double>                                  eigen,
                                                   std::vector<SG::DataStructure::Post::EIGENVECTOR_CPLXData>& entity) = 0;
};

template <>
std::shared_ptr<IEIGENVECTOR_CPLXService> DBManager_DECLSPEC DBServiceFactory::get ();

SG_DBMANAGER_NAMESPACE_CLOSE